<%@ page language="java" import="java.sql.*" contentType="text/html;  charset=UTF-8"  
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
 <br>  
   <%  
   request.setCharacterEncoding("utf-8");  
   String users=request.getParameter("name");  
   String pass=request.getParameter("pwd");  
   %>  
   <%   
    String driver = "com.mysql.jdbc.Driver";    
    String url = "jdbc:mysql://localhost:3306/exam?useUnicode=true&characterEncoding=UTF-8";    
    String use = "root";     
    String password = "123456";    
    Class.forName(driver);    
    Connection conn= DriverManager.getConnection(url,use,password);    
    PreparedStatement sql =conn.prepareStatement("insert into cgw_t_login(name,pwd) values(?,?)");  
    sql.setString(1,users);  
    sql.setString(2,pass);   
    sql.executeUpdate();  
    sql.close();  
    conn.close();  
    %>  
</body>
</html>